package com.example.design.observer;

/**
 * @author hej
 * @date 2022/11/4 16:07
 */
public class AliCurrentConditions implements Observer{
    /**
     * 气温，气压，湿度
     */
    private float temperature, pressure, humidity;

    @Override
    public void update(float temperature, float pressure, float humidity) {
        this.temperature = temperature;
        this.pressure = pressure;
        this.humidity = humidity;
        // 模拟展示
        display();
    }

    private void display() {
        System.out.println("阿里天气预报通知，当前的气温是：" + temperature);
        System.out.println("阿里天气预报通知，当前的气压是：" + pressure);
        System.out.println("阿里天气预报通知，当前的湿度是：" + humidity);
    }
}
